package com.itcam.api;

import jakarta.servlet.ServletContext;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;

/**
 * Author:Cammy.Wu
 * Date:2024-04-30
 * Description:
 */

@Controller
public class ApiController {
    public void data(HttpServletResponse response,
                     HttpServletRequest request,
                     HttpSession session){
        //使用原生对象就可以
        //ServletContext[1.最大的配置文件 2.全局最大共享域 3.核心api getRealPath]
        //方案1：request获取 session获取
        ServletContext servletContext = request.getServletContext();
        ServletContext servletContext1 = session.getServletContext();

        // 方案2：ServletContext会自动装入到ioc容器！程序启动servletContext - ioc容器
        // 直接全局注入就可以
    }
}
